const devtoolMap = {
  production: 'nosources-source-map',
  development: 'eval-source-map',
  debug: 'eval-source-map',
};
const devtool = devtoolMap[process.env.NODE_ENV];

module.exports = {
  publicPath: '/mate-store',
  // filenameHashing: false,
  configureWebpack: {
    devtool,
  },
  devServer: {
    port: 3002,
    proxy: {
      '/oauth': {
        target: 'https://openapi.baidu.com',
        ws: true,
        headers: {
          Referer: '',
        },
        changeOrigin: true
      },
      '/rest/2.0/xpan': {
        target: 'https://pan.baidu.com',
        ws: true,
        headers: {
          Referer: '',
        },
        changeOrigin: true
      },
      '/api/quota': {
        target: 'https://pan.baidu.com',
        ws: true,
        headers: {
          Referer: '',
        },
        changeOrigin: true
      },
      '/file': {
        target: 'https://d.pcs.baidu.com',
        ws: true,
        headers: {
          Referer: '',
        },
        followRedirects: true,
        changeOrigin: true
      },
    }
  }
};
